@model EdgeSharp.WinForms.Razor.Sample.Models.MovieGenreViewModel

@{
    ViewData["Title"] = "Index";
}

<div class="container justify-content-center mt-3">
    <p>
        <a class="btn btn-primary btn-sm" role="button" asp-action="Create">Create New</a>
    </p>

    <form asp-controller="Movies" asp-action="Index" method="get">
        <div class="row">
            <div class="col-3">
                <select class="form-select col-sm-6" asp-for="MovieGenre" asp-items="Model.Genres">
                    <option value="">All</option>
                </select>
            </div>
            <div class="col-6">
                <div class="col-auto input-group mb-3">
                    <input type="text" class="form-control" placeholder="Search title" aria-label="Search title" aria-describedby="button-addon" asp-for="SearchString">
                    <input class="btn btn-outline-primary btn-sm" type="submit" id="button-addon2=" value="Filter" />
                </div>
            </div>
        </div>
    </form>
</div>

<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Movies[0].Title)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Movies[0].ReleaseDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Movies[0].Genre)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Movies[0].Price)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Movies[0].Rating)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model.Movies)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ReleaseDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Genre)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Price)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Rating)
                </td>
                <td>
                    <a class="btn btn-info btn-sm" role="button" asp-action="Edit" asp-route-id="@item.Id">Edit</a>
                    <a class="btn btn-success btn-sm" role="button" asp-action="Details" asp-route-id="@item.Id">Details</a>
                    <a class="btn btn-danger btn-sm" role="button" asp-action="Delete" asp-route-id="@item.Id">Delete</a>
                </td>
            </tr>
        }
    </tbody>
</table>
